<?php

// no direct access
defined('_JEXEC') or die('Restricted access');

// import application controller
jimport('joomla.application.component.controller');

class SyncrController extends JController
{
	public function __construct($config = array()) {
		parent::__construct($config);
	}
	
	public function display()
	{	
		// format as json
		$document =& JFactory::getDocument(); 
		$document = JDocument::getInstance('json'); 
		
		// default view
		if (!$view = JRequest::getVar('view')) {
			JRequest::setVar('view', 'default');
		}
		
		// set up the view
		$view =& $this->getView('default','json');
		
		// decide view to load
		switch($task = JRequest::getCmd('task', '', 'default', 'cmd')) {
						
			case 'categories':
				$model	=& $this->getModel('categories');
				$view->setModel($model, true);
				break;
				
			case 'content':
				$model	=& $this->getModel('content');
				$view->setModel($model, true);
				break;
				
			case 'request':
				$model =& $this->getModel('request');
				$view->setModel($model, true);
				break;
				
			case 'receive':
				$model =& $this->getModel('receive');
				$view->setModel($model, true);
				break;
				
			case 'process':
				$model =& $this->getModel('process');
				$view->setModel($model, true);
				break;
				
			case 'cleanup':
				$model =& $this->getModel('cleanup');
				$view->setModel($model, true);
				break;
		}
						
		// call parent behavior
		parent::display();
	}
}